home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1996 #6
/
Amiga Plus CD - 1996 - No. 06.iso
/
pd
/
grafik
/
imageengineerv3.1
/
extra
/
dopus5
/
arexx
/
ie_convert.dopus5
next >
Wrap
Text File
|
1996-07-14
|
5KB
|
191 lines
/*
** $VER: IE_Convert.dopus5 1.0 (14/7 Stockholm/Sweden)
** Copyright © 1996 by Patrik M Nydensten
**
** Converts all selected image files in the SRCE directory and
** saves them into DEST directory.
** Requires Image Engineer 3.0 or higher and DOpus 5.0 or higher.
** Call: (AREXX) DOpus5:arexx/IE_Convert.dopus5 {Qp}
*/
CFG_PALETTE_DIR = '"DH1:Works/Palette/"'
options results
lf='0a'x
parse arg portname
if left(portname,5)='DOPUS' then address value portname
else exit
if ~show(ports,'IMAGEENGINEER') then do
dopus request '"Could not locate IEs arexx port!" OK'
exit
end
/* Get info from DOpus */
lister query source /* get source handler */
handle = result
if RC~= 0 then exit
lister query dest /* get destination handler */
dhandle = result
if RC~= 0 then do
dopus request '"No DEST directory selected" OK'
exit
end
lister query handle path /* get current source path */
src_path = strip(result,B,'"')
lister query dhandle path /* get current dest path */
dst_path = strip(result,B,'"')
lister query handle selfiles ':' /* get selected file names */
sel_files = result
lister query handle numselfiles /* get number of selected files */
num_files = result
if num_files = 0 then exit
/* Get info from IE */
address 'IMAGEENGINEER'
IE_TO_FRONT
'GET_FILE_TYPE "Select destination file format."'
if RC~= 0 then do
address value portname
dopus front
dopus request '"User did not select file type!" OK'
exit
end
else FileType = result
'REQUEST' '"Would you like to save rendered or 24bit image?"' '" Render | 24bit "'
do_render = result
if do_render = 1 then do /* get render info */
'RENDER_GET "Set render options."'
if RC~= 0 then do
address value portname
dopus front
dopus request '"User did not select render options!" OK'
exit
end
else RenderOptions = result
if word(RenderOptions,5) = 0 then do /* let user pick lock-palette */
'GET_FILE "Select a palette to lock." "Use"' CFG_PALETTE_DIR
if RC~= 0 then do
address value portname
dopus front
dopus request '"User did not select lock-palette!" OK'
exit
end
else do_palette = result
end /* end of pick lock-palette */
end /* end of get render info */
/* Start process */
address value portname
dopus front
lister set handle progress num_files 'Converting images...'
do i = 1 to num_files /* convert loop */
address value portname
parse var sel_files image_file ':' sel_files
image_file = strip(image_file,B,'"')
lister set handle progress name image_file /* update progress display */
lister query handle abort /* check if aborted */
if result then do
lister clear handle progress /* exit progress display mode */
lister refresh handle 'full'
lister refresh dhandle 'full'
lister read dhandle dst_path force
dopus front
dopus request '"User aborted..." OK'
lister clear handle abort
exit
end
nil = convert(image_file)
address value portname
lister set handle progress count i /* update progress display */
lister refresh handle full /* update lister display */
end /* end of load loop */
lister clear handle progress /* exits progress display mode */
lister refresh handle 'full' /* update source */
lister refresh dhandle 'full' /* update dest */
lister read dhandle dst_path force
dopus front
exit
Convert:
parse arg file
address 'IMAGEENGINEER'
file_ext = '.'||word(strip(filetype),1)
'OPEN "'||src_path||file||'" 24'
if (RC ~= 0) then do
address value portname
dopus request '"Error when loading image' file '!" OK'
end
else do
Project = result
if do_render = 1 then do /* render image */
if do_palette~='DO_PALETTE' then do
'LOAD_PALETTE' Project '"'||do_palette'"'
if (RC ~= 0) then do
address value portname
dopus request '"Error when loading lock-palette:'||lf||do_palette||lf||'Processing image anyway." OK'
address 'IMAGEENGINEER'
end
end
'RENDER_SET' Project RenderOptions
'RENDER' Project 'QUIET'
'SAVE' Project '"'||dst_path||file||file_ext||'"' '"'||filetype||'"'
if (RC ~= 0) then do
address value portname
dopus request '"Error when saving image' file '!" OK'
address 'IMAGEENGINEER'
end
else do
address value portname
lister select handle '"'||image_file||'"' off
end
end
else do /* do not render image */
'SAVE_DATA' Project '"'||dst_path||file||file_ext||'"' '"'||filetype||'"'
if (RC ~= 0) then do
address value portname
dopus request '"Error when saving image' file '!" OK'
address 'IMAGEENGINEER'
end
else do
address value portname
lister select handle '"'||image_file||'"' off
end
end
address 'IMAGEENGINEER'
'CLOSE' Project
end
return nil